package com.cd.dao;

import com.cd.entity.Book;
import com.cd.mapper.BookMapper;
import com.cd.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.io.IOException;
import java.util.List;

/**
 * 类名：
 * 作者：WF
 * 功能：
 */
public class BookDao {

	// 1. 查询所有图书
	public List<Book> findAll() throws IOException {
		try(SqlSession session = MybatisUtil.getSqlSession(true)) {
			BookMapper mapper = session.getMapper(BookMapper.class);
			return mapper.selectByExample(null);
		}
	}
}
